import {
    post,
    get
} from '../../http/axios'

export default {
    namespaced: true,
    state: {
        categoryList: []
    },
    mutations: {
        set_categoryList(state, val) {
            state.categoryList = val;
        },
    },
    actions: {
        async findAll(context) {
            let res = await get('/category/findAll');
            context.commit('set_categoryList', res.data)
                //   console.log(res.data, '========');

        },
        async saveOrUpdate({
            commit
        }, params) {
            let res = await post('/category/saveOrUpdate', params);
            return res;
        },
        async deleteById({
            commit
        }, params) {
            let res = await get('/category/deleteById', params);
            return res;
        },

    }
}